package com.cnbot.httpsdk.api;

import com.cnbot.dchttpsdk.api.ApiEngine;
import com.cnbot.dchttpsdk.constant.HttpConstant;
import com.cnbot.dchttpsdk.helper.DownFileProgressListener;

import rx.Observable;
import rx.Subscriber;

/**
 * 描述：
 * 作者：dc on 2019/1/18 17:18
 * 邮箱：597210600@qq.com
 */
public class ApiHelper {

    public static IHttpInterface getApiService() {

        return (IHttpInterface) ApiEngine.build().getApiService(HttpConstant.HTTPSERVICEIP);

    }

    public static IHttpInterface getDownloadService(DownFileProgressListener l, String path) {

        return (IHttpInterface) ApiEngine.build().getApiService(HttpConstant.HTTPSERVICEIP, l, path);

    }


    /**
     * 查询航班
     * @param subscriber
     */
    public static void getByPlaceCond(Subscriber subscriber, int pageNo ,int pageSize , String airportCode ,String aord ,String airlineCode ,String airlineName ,String queryDate ) {
        Observable observable = getApiService().getByPlaceCond(pageNo, pageSize, airportCode, aord, queryDate);
        ApiEngine.build().toSubscribe(observable, subscriber);
    }


    /**
     * 查询航班
     * @param subscriber
     */
    public static void getBasicsAir(Subscriber subscriber) {
        Observable observable = getApiService().getBasAirport();
        ApiEngine.build().toSubscribe(observable, subscriber);
    }

}
